<strong><%= @event.formatted_date rescue nil %></strong>

<% @event.instances.sort_by {|a| a.instance_type.name}.each do |i| %>
	<div>
		<h3><%= i.instance_type.name %></h3>
	</div><hr>
	<div>
		<table border="0" cellspacing="2" cellpadding="2">
			<tr>
				<th>Group</th>
				<th># Leaders</th>
				<th># participants</th>
			</tr>
			<% i.meetings.sort_by {|m| m.group.name}.each do |m| %>
			<tr>
				<td><%= m.group.name %></td>
				<td><%= m.leaders_count %></td>
				<td><%= m.participants_count %></td>
			</tr>
			<% end %>
		</table>
		
	</div><br>
	<div style="float:none;clear:both;">
		<span style="float:right;">
		<strong>Instance Total: <%= i.meetings.sum(:total_count) rescue nil %></strong>
		</span>
	</div>
<% end %>

<div style="float:none;clear:both;">
	<span style="float:right;">
	<strong>Event Total: <%= @event.head_count['head_count'] rescue nil %></strong>
	</span>
</div>

<%= link_to 'edit', :action => 'edit_counts', :id => @event %>